package gui.newgui.mainpanel;

import gui.newgui.IArCompGuiComponent;
import gui.newgui.IController;
import gui.newgui.RankingPanel;
import gui.newgui.ScoresPanel;
import gui.newgui.TargetAssignmentPanel;
import gui.newgui.playerassignmentpanel.PlayerAssignmentPanel;

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;

import javax.swing.JFrame;
import javax.swing.JTabbedPane;
import javax.swing.WindowConstants;

import core.GuiComponentLabels;

public class MainPanel extends javax.swing.JPanel implements IArCompGuiComponent {
	private IController controller;
	private JTabbedPane mainTabbedPane;

	private IArCompGuiComponent playerAssignmentPanel;
	private IArCompGuiComponent targetAssignmentPanel;
	private IArCompGuiComponent scoresPanel;
	private IArCompGuiComponent rankingPanel;

	/**
	 * Auto-generated main method to display this JPanel inside a new JFrame.
	 */
	public static void main(String [] args) {
		JFrame frame = new JFrame();
		frame.getContentPane().add(new MainPanel());
		frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
		frame.pack();
		frame.setVisible(true);
	}

	public MainPanel() {
		super();
		this.initGUI();
	}

	private void initGUI() {
		try {
			BorderLayout thisLayout = new BorderLayout();
			this.setLayout(thisLayout);
			this.setPreferredSize(new Dimension(400, 300));
			{
				this.mainTabbedPane = new JTabbedPane();
				this.add(this.mainTabbedPane, BorderLayout.CENTER);
				this.playerAssignmentPanel = new PlayerAssignmentPanel();
				this.mainTabbedPane.add(GuiComponentLabels.PARTICIPANTS, (Component) this.playerAssignmentPanel);
				this.targetAssignmentPanel = new TargetAssignmentPanel();
				this.mainTabbedPane.add(GuiComponentLabels.TARGET_ASSIGNMENT, (Component) this.targetAssignmentPanel);
				this.scoresPanel = new ScoresPanel();
				this.mainTabbedPane.add(GuiComponentLabels.SCORES, (Component) this.scoresPanel);
				this.rankingPanel = new RankingPanel();
				this.mainTabbedPane.add(GuiComponentLabels.RANKING, (Component) this.rankingPanel);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	@Override
	public IController getController() {
		return this.controller;
	}

}
